package com.bc.common;

import java.util.Objects;

public class CommonEnum {
	
	/**
	 * 订单状态
	 * 
	 * @author zhongzhanfeng
	 *
	 */
	public enum OrderStatus {
		Create("TC","已下单,待支付"),Success("TS","成功"), Fail("TF","失败"), Unknow("TU","未知"),InProcess("TI","处理中"), Cancle("CX","已撤销"),
		DoRefund("DF","退款申请"),Refund("RF","已退款");
		
		public static OrderStatus parse(String val) {
			for (OrderStatus os : OrderStatus.values()) {
				if(Objects.equals(val, os.getValue())) {
					return os;
				}
			}
			return null;
		}
		
		private String value;
		private String name;
		
		private OrderStatus(String value){
			this.value = value;
		}

		private OrderStatus(String value,String name) {
			this.value = value;
			this.name = name;
		}
		
		@Override
		public String toString() {
			return value;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}
		
	}
	
	/**
	 * 通知状态
	 * 
	 * @author zhongzhanfeng
	 *
	 */
	public enum NotifyStatus {
		Success("1"), Wait("0"), Fail("2");

		private String value;

		private NotifyStatus(String value) {
			this.value = value;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}
	}
	
	/**
	 * 请求响应
	 * @author zhongzhanfeng
	 *
	 */
	public enum Resp{
		
		Success("00","成功"),
		Fail("01","失败"),
		CodeHasExpired("02", "验证码已过期，请重新获取"),
		NotEnough("11","余额不足"),
		InProcess("99","交易处理中");
		
		private String code;
		private String msg;
		
		private Resp(String code,String msg){
			this.code = code;
			this.msg = msg;
		}
		public String getCode() {
			return code;
		}
		public void setCode(String code) {
			this.code = code;
		}
		public String getMsg() {
			return msg;
		}
		public void setMsg(String msg) {
			this.msg = msg;
		}
		
	}

}
